package com.greathiit.printserver.conf;

import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration

public class RabbitConfig {

	/**
	 * 
	 * 初始化监听器
	 * 
	 * @param connectionFactory
	 * 
	 * @return
	 * 
	 */

	@Bean

	public SimpleMessageListenerContainer simpleMessageListenerContainer(ConnectionFactory connectionFactory) {

		SimpleMessageListenerContainer simpleMessageListenerContainer = new SimpleMessageListenerContainer();

		simpleMessageListenerContainer.setAcknowledgeMode(AcknowledgeMode.MANUAL);

		simpleMessageListenerContainer.setConnectionFactory(connectionFactory);

		return simpleMessageListenerContainer;

	}

}